import { type chatType } from '@/api/type/application';
import { Button } from 'antd'; // 假设使用 element-react 库中的 Button 组件
import ChatOperationButton from './ChatOperationButton';

interface ChatOperationButtonsProps {
    type: 'log' | 'ai-chat' | 'debug-ai-chat'
    chatRecord: chatType
    application: any
    loading: boolean
    startChat: (chat_record: any) => void
    stopChat: (chat_record: any) => void
    onRgenerationChart: (chat_record: any) => void
}   
const ChatOperationButtons = ({
    type,
    chatRecord,
    application,
    loading,
    startChat,
    stopChat,
    onRgenerationChart
}: ChatOperationButtonsProps) => {
    return (
        <div>
            { type != 'log' &&  (<div className="flex-between mt-8">
                <div>
                    {chatRecord.is_stop && !chatRecord.write_ed ? (
                        <Button type="link"  onClick={() => startChat(chatRecord)}>
                            继续
                        </Button>
                    ) : !chatRecord.write_ed ? (
                        <Button type="link" onClick={() => stopChat(chatRecord)}>
                            停止回答
                        </Button>
                    ) : null}
                </div>
            </div>)}
            
            { chatRecord.write_ed && 500 != chatRecord.status && (
                <div className="flex-between">
 <ChatOperationButton
      tts={application.tts_model_enable}
      tts_type={application.tts_type}
      data={chatRecord}
      type={type}
      applicationId={application.id}
      chatId={chatRecord.chat_id}
      chat_loading={loading}
      onRegeneration={() => onRgenerationChart && onRgenerationChart(chatRecord)}
    />
                </div>
            )}
        </div>
    );
};

export default ChatOperationButtons;